/**   
 * Copyright © 2019 eSunny Info. Tech Ltd. All rights reserved.
 * 
 * @Description:TODO(功能)
 * @className HelloServlet.java
 * @Package: com.bus.servlet 
 * @author: yj   
 * @date: 2019年1月26日 上午9:48:13 
 */
package com.erp.servlet;

import java.io.IOException;

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * @className HelloServlet.java
 * @author yj
 * @Description:TODO(功能)
 * @Date 2019年1月26日
 */
public class HelloServlet implements Servlet {

	private ServletConfig config;
	
	@Override
	public void destroy() {
		System.out.println("销毁!!!");
	}

	@Override
	public ServletConfig getServletConfig() {
		return null;
	}

	@Override
	public String getServletInfo() {
		return null;
	}

	@Override
	public void init(ServletConfig config) throws ServletException {
		System.out.println("初始化!!!");
		this.config = config;
		ServletContext context = config.getServletContext();
	}

	@Override
	public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
		
		// 获取文件 绝对路径
		ServletContext context = config.getServletContext();
		String path = context.getRealPath("db.properties");
		System.out.println(path);
		
	}

}
